package com.cskaoyan.util;

/**
 * @author 陈泉江
 * @version 1.0
 * @description: 随机生成优惠券码
 * @date 2021/6/8 20:55
 */
public class RedeemCodeUtils {
    public static String createBigSmallLetterStrOrNumberRadom(int num) {

        String str = "";
        for (int i = 0; i < num; i++) {
            int intVal = (int) (Math.random() * 26 + 65);
            if (intVal >= 91 && intVal <= 96) {
                i--;
            }
            if (intVal < 91){
                if (intVal % 2 == 0) {
                    str += (char) intVal;
                } else {
                    str += (int) (Math.random() * 10);
                }
            }
        }
        return str;
    }
}
